package com.huike.util;

public class UserContext {
    // 单例模式
    private static final ThreadLocal<Long> user = new ThreadLocal<>();

    // 查询ThreadLocal的数据
    public static Long getUser() {
        return user.get();
    }

    // 设置ThreadLocal的数据
    public static void setUser(Long id){
        user.set(id);
    }


    // 删除ThreadLocal中数据
    public static void remove(){
        user.remove();
    }

}
